From: Marc-Antoine Perennou Date: Fri, 17 Feb 2012 19:48:25 +0000 (+0100) Subject: pokit-agent: fix segfault when we we fail to get the current session X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~7015 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b67138b5ae677e8af9f7fa978f812438e1c4b912;p=gnome-shell.git pokit-agent: fix segfault when we we fail to get the current session When using systemd, polkit doesn't set the error even when returning false in g_initable_init Signed-off-by: Marc-Antoine Perennou https://bugzilla.gnome.org/show_bug.cgi?id=670319 --- diff --git a/src/shell-polkit-authentication-agent.c b/src/shell-polkit-authentication-agent.c index ede4fd97b..472dea51b 100644 --- a/src/shell-polkit-authentication-agent.c +++ b/src/shell-polkit-authentication-agent.c @@ -108,11 +108,18 @@ shell_polkit_authentication_agent_init (ShellPolkitAuthenticationAgent *agent) &error); if (subject == NULL) { - g_warning ("Error getting session for the process we are in: %s (%s %d)", - error->message, - g_quark_to_string (error->domain), - error->code); - g_error_free (error); + if (error) /* polkit version 104 and older don't properly set error on failure */ + { + g_warning ("Error getting session for the process we are in: %s (%s %d)", + error->message, + g_quark_to_string (error->domain), + error->code); + g_error_free (error); + } + else + { + g_warning ("Error getting session for the process we are in"); + } goto out; }